//
//  TransferOutConfirmViewController.m
//  TenMinDemo
//
//  Created by Shawn Li on 2021/3/8.
//  Copyright © 2021 CYXiang. All rights reserved.
//

#import "TransferOutConfirmViewController.h"
#import "OperateResultViewController.h"
#import "SafetyConfirmView.h"
#import "SimplePromptView.h"
@interface TransferOutConfirmViewController ()
@property (nonatomic,strong) SafetyConfirmView* safetyView;
@end

@implementation TransferOutConfirmViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.
}
- (IBAction)confirmAction:(id)sender {
    LRWeakSelf(self)
//    if (!self.safetyView) {
//        self.safetyView = [[SafetyConfirmView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, SCREENH_HEIGHT)];
//        self.safetyView.doneBlock = ^{
//            [weakself showPrompt:@"23423423423"];
//        };
//    }
//    
//    [self.safetyView showInView:self.navigationController.view];
}

- (void)showPrompt:(NSString *)msg{
    
    SimplePromptView *view = [[SimplePromptView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, SCREENH_HEIGHT)];
    LRWeakSelf(self);
    view.doneBlock = ^{
        [weakself showTransferOutDone];
    };

    [view showInView:self.navigationController.view];
    
//    [self.navigationController.view addSubview:view];
}
- (void)showTransferOutDone{
    OperateResultViewController *vc = LoadVCFormXib(OperateResultViewController);
    [self.navigationController pushViewController:vc animated:YES];
}

-(void)keyboardChangeFrame:(NSNotification*)noti{

    CGRect rect= [noti.userInfo[UIKeyboardFrameEndUserInfoKey]CGRectValue];
    NSLog(@"%@", noti.userInfo);
    CGFloat keyboardheight = rect.size.height;
    CGFloat duration=[noti.userInfo[UIKeyboardAnimationDurationUserInfoKey]doubleValue];
    CGFloat curve=[noti.userInfo[UIKeyboardAnimationCurveUserInfoKey]doubleValue];

    [UIView setAnimationCurve:curve];
    [UIView animateWithDuration:duration animations:^{
        self.safetyView.bgBottom.constant = keyboardheight - 30;
        [self.safetyView layoutIfNeeded];
    } completion:^(BOOL finished) {
        
    }];
}

-(void)keyboardHide:(NSNotification *)noti
{
    [self.view endEditing:YES];

    [UIView animateWithDuration:0.35 animations:^{
        self.safetyView.bgBottom.constant = 0;
        [self.safetyView layoutIfNeeded];
      
    } completion:^(BOOL finished) {
        
    }];

}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
